package com.huanzhidadi.rabbitmq.seqqueuewithredis.producer;

import com.huanzhidadi.rabbitmq.seqqueuewithredis.entity.MessageInfo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class ProducerSeq {
    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 根据id，将消息顺序发送到对应的队列
     * @param messageInfo
     */
    public void send(MessageInfo messageInfo) {
        // 注意第二个参数
        rabbitTemplate.convertAndSend("fanout_seq", "", messageInfo);
    }
}
